﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GS.Config;
using System.Data;
using GS.CMS.Entities;
using System.Web.Caching;

public partial class frontend : System.Web.UI.MasterPage
{
    Category _Category = new Category();
    string strSessionMenu = "Menu";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
             BindSource();
        }
    }
    private void BindSource()
    {
        try
        {
            DataSet dsFunction = null;
            //dsFunction = this.Context.Cache["dsFunction"] as DataSet;
            //if (dsFunction == null)
            //{
                dsFunction = _Category.GetAllFunction();
                //this.Context.Cache.Insert("dsFunction", dsFunction, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero, CacheItemPriority.Default, null);
            //}
            _Menu.Menu = dsFunction.Tables[0];
            Session[strSessionMenu] = dsFunction.Tables[0];
            _SeachBox.dtCategoryRoot = dsFunction.Tables[0];
            //IndexProducts.IndexProduct = dsFunction.Tables[2];
            //News.News = dsFunction.Tables[3];
           // SupportOnline.SupportOnline = dsFunction.Tables[4];
            //Adv.DataAdv = dsFunction.Tables[5];
            //_SearchProduct.DataGraphic = _dsfunction.Tables[7];
            //_SearchProduct.DataSpeed = _dsfunction.Tables[8];
            //_SearchProduct.DataRam = _dsfunction.Tables[9];
            //_SearchProduct.DataOS = _dsfunction.Tables[10];
            //_SearchProduct.DataHDD = _dsfunction.Tables[11];
            //_SearchProduct.DataCamera = _dsfunction.Tables[12];
            //_Advertisement.DataAdv = _dsfunction.Tables[13];
            //_Statics.DataStatistic = _dsfunction.Tables[14];
            //_HitProduct.DataHitPro = _dsfunction.Tables[15];
            //BindMenu(dsFunction.Tables[0]);
        }
        catch (Exception ex)
        {
            TrackingError.AddTrackingError("Author: sanghv - Funtion: LoadMenu - Usercontrol:menu-horizontal", ex.Message);
        }
    }
}
